<?php $form=$this->beginWidget('CActiveForm', array(
        'id'=>'param-form',
        'enableClientValidation'=>true,
        'clientOptions'=>array(
            'validateOnSubmit'=>false,
        ),
        'enableAjaxValidation'=>true,
        'htmlOptions' => array('class' => 'stdform')
    )); ?>

<div class="par control-group">
	<?php echo $form->errorSummary($model);?>
</div>
<div class="par control-group">
	<?php echo $form->labelEx($model,'name', array('class' => 'control-label')); ?>
	<div class="controls">
		<?php echo $form->textField($model,'name',array('maxlength'=>255, 'class' => 'input-large')); ?>
        <?php echo $form->error($model,'name', array('class' => 'help-inline error'));?>
	</div>
</div>

<p>
<label>Parent param</label>
<span class="formwrapper">
	<?php
		$parent= $model->getParams();
		if (Yii::app()->controller->action->getId() == 'update') 
		{
			unset($parent[$_GET['id']]);
		}
// 			echo 'update: ' .$_GET['id'];
	?>
	<?php echo $form->dropDownList($model, 'parent_id', $parent, array(
			'empty' => 'Chọn ...',
			'class' => 'chzn-select',
			'style' => 'width:350px', 'tabindex' => '2')); ?>
</span>
</p>


<p>
<label>Group</label>
<span class="field">
	<?php echo $form->dropDownList($model, 'group_id', ParamGroup::model()->getParamGroup(), array('class' => '',
			'style' => 'width:250px', 'tabindex' => '2', 'empty' => 'Chọn ...')); ?>
	<?php echo $form->textField($model, 'groupName', array('class' => 'input-large')); ?>
</span>
</p>
                       
<p class="stdformbutton">
    <?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save', array('class' => 'btn btn-info')); ?>
</p>
<?php $this->endWidget(); ?>